Casper CBC: block chain protocol simulation design
This doc is obsoleted :)
Overview
Block: Consensus value, which has contains slot number and parent block hash.
Justification: Mapping from validator to latest message.
Message: Tuple of (the id of ?) sender, estimate and justification.
State: Each validator's view, which contains state transition method.
Validator: Each validator, which creates or adds messages to state.
Estimator: The implementation of LMD Ghost.
Weight: Calculating of weights from block (state).
Network: Handling low layer matters such that network latency, order of sending messages, etc, and representing "global state"
Simulation: Controll all others.
SimulationConfig
Visualizer: visualizing!!
Spec
Block
fields
parent: Int
hash: Int
methods
serialize(): str
Justification
fields
latest_messages: Dict[Validator, int]
methods
serialize(): str
Message
fields
sender: Validator
estimate: Block
justification: Justification
slot: Int
hash: int
methods
serialize(): str
State
fields
last_finalized_block: Block
message_history: Dict[Validator, List[Message]]
mapping from validator to its message list
children: Dict[Block, List[Block]]
methods
transition(message: Message)
self.validate(message)
self.safety(message)
safety(message: Message): float
CliqueOracle().estimate_safety(self, message)
validate(message): bool
detect invalid or equivocating message
justification(): Justification
serialize(): str
Validator
fields
name: str
weight: float
state: State
methods
public
create_message(): Message
sender: self
estimate: Estimator().estimate(state: State)
justification: self.state.justification()
add_message(message: Message)
self.state.transition(message)
Estimator
methods
estimate(state: State) -> Block
verify(state: State, block: Block) -> bool
Weight
methods
weights(state: State) -> Dict[Validator, float]
Network
fields
validators: List[Validator]
message_history: Dict[Validator, List[Message]]
mapping from validator to its message list
methods
send_and_receive(from: Validator, to: Validator)
handle latency
serialize(): str
Simulation
fields
config: SimulationConfig
SimulationConfig
fields
validator_num
number of validators
network_latency
latency of network (e.g. gaussian distribution)
validator_rotation
validator rotation strategy (e.g. random)
message_mode
message creating strategy (e.g. random)
etc...
Visualizer
Details